FUNCTION IniReadInt &
!
(key, iniDB, section, subSection, default)
IMPLICIT NONE
! subroutine arguments
! Scalar arguments with intent(in):
CHARACTER (LEN = *), INTENT(IN) :: key
TYPE (IniList) , INTENT(IN) :: iniDB
CHARACTER (LEN = *), OPTIONAL, INTENT(IN) :: section
CHARACTER (LEN = *), OPTIONAL, INTENT(IN) :: subSection
INTEGER (KIND = long), OPTIONAL, INTENT(in) :: default
! Scalar arguments with intent(out):
INTEGER (KIND = long) :: IniReadInt
! Local Scalars:
CHARACTER(LEN = stringLen) :: s
!------------end of declaration------------------------------------------------
IF ( PRESENT (section) .AND. PRESENT (subSection) ) THEN
s = IniReadString(key, iniDB, section = section, subSection = subSection)
ELSE IF ( PRESENT (section) .AND. .NOT.PRESENT (subSection)) THEN
s = IniReadString(key, iniDB, section = section)
ELSE
s = IniReadString(key, iniDB)
ENDIF
IF (s == '') THEN
IF ( PRESENT (default) )THEN
IniReadInt = default
ELSE
CALL Catch ('error', 'read ini file', &
'key not found: ' , code = iniIOError, &
argument = key )
ENDIF
ELSE
READ (s,*, IOSTAT = ios) IniReadInt
IF (ios > 0) THEN
CALL Catch ('error', 'read ini file', &
'error reading integer for key: ' , &
code = iniIOError, argument = key )
ENDIF
END IF
RETURN
END FUNCTION IniReadInt